'use strict';

const Controller = require('egg').Controller;

class NpmController extends Controller {
  async index() {
    const { ctx } = this;
    const result = await ctx.curl('http://registry.npm.taobao.org/egg/latest', {
      dataType: 'json',
      timeout: 3000
    })
    ctx.body = {
      status: result.status,
      headers: result.headers,
      package: result.data
    }
  }
}

module.exports = NpmController